package com.aube.mis.enums;

public enum ResponseCode {
	
	// 本网站返回码
	SUCCESS("00", "操作成功"), 
	PARAM_ERROR("WEB_01", "参数异常"), 
	BIZ_ERROR("WEB_02", "业务异常"), 
	SYSTEM_ERROR("WEB_99", "系统异常"),
	
	// 后端返回码
	;
	
	private String code;
	private String msg;

	ResponseCode(String code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public String getCode() {
		return code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public static ResponseCode getEnumByCode(String code) {
		for (ResponseCode e : ResponseCode.values()) {
			if (e.getCode().equals(code)) {
				return e;
			}
		}
		return null;
	}
	public static String getDescByCode(String code) {
		for (ResponseCode e : ResponseCode.values()) {
			if (e.getCode().equals(code)) {
				return e.getMsg();
			}
		}
		return null;
	}
}
